#include <stdio.h>
#include <unistd.h>


int main()
{
	printf("这是父进程：%d\n",getpid());

	int ret = fork();
	if(ret)
	{
		printf("父进程中 ret:%d\n",ret);
		int n=0;
		while(1)
		{
			printf("n:%d\n",n++);
			sleep(1);
		}
	}
	else
	{
		printf("子进程里执行fork 返回ret:%d\n",ret);
		printf("这是子进程：%d，它的父进程id为:%d\n",getpid(),getppid());
		int m=0;
		while(1)
		{
			printf("m:%d\n",m++);
			sleep(1);
		}
	}

	return 0;
}